
#pragma once

#include <WinDef.h>

#include <DXGI.h>
#include <D3D10_1.h>
#include <D3DX11.h>
#include <D3DX10math.h>

#include "Core\Globals.h"
#include "Math\Vector4.h"
#include "Tools\RGBColor.h"

class Light
{
public:
	enum Type
	{
		DIRECTIONAL,
		POINT,
		SPOT,
	};

public:
	//Light();
	Light(CONST Vector4& position,
		  CONST Vector4& direction,
		  FLOAT angle,
		  FLOAT radius,
		  CONST RGBColor& ambient,
		  CONST RGBColor& diffuse,
		  CONST RGBColor& specular,
		  FLOAT constant_attenuation,
		  FLOAT linear_attenuation,
		  FLOAT quadratic_attenuation,
		  FLOAT exponent);
	Light(FLOAT px = 0.0f, FLOAT py = 0.0f, FLOAT pz = 0.0f, FLOAT pw = 1.0f,
		  FLOAT dx = 0.0f, FLOAT dy = 0.0f, FLOAT dz = 1.0f,
		  FLOAT angle = D3DX_PIF,
		  FLOAT radius = D3D10_FLOAT32_MAX,
		  FLOAT ar = 1.0f, FLOAT ag = 0.9f, FLOAT ab = 0.2f,
		  FLOAT dr = 1.0f, FLOAT dg = 0.9f, FLOAT db = 0.2f,
		  FLOAT sr = 1.0f, FLOAT sg = 0.9f, FLOAT sb = 0.2f,
		  FLOAT constant_attenuation = 0.0f,
		  FLOAT linear_attenuation = 0.0f,
		  FLOAT quadratic_attenuation = 1.0f,
		  FLOAT exponent = 1.0f);
	~Light();

	Light(CONST Light& other);
	Light& operator = (CONST Light& other);

	// Getters & Setters.
	//-----------------------------------------------
	Type GetType() CONST;

	Vector4 GetPosition() CONST;
	VOID SetPosition(CONST Vector4& position);
	VOID SetPosition(FLOAT x, FLOAT y, FLOAT z);

	Vector4 GetDirection() CONST;
	VOID SetDirection(CONST Vector4& direction);
	VOID SetDirection(FLOAT x, FLOAT y, FLOAT z);
	
	FLOAT GetAngle() CONST;
	VOID SetAngle(FLOAT angle);

	FLOAT GetRadius() CONST;
	VOID SetRadius(FLOAT radius);

	RGBColor GetAmbient() CONST;
	VOID SetAmbient(CONST RGBColor& color);
	VOID SetAmbient(FLOAT r, FLOAT g, FLOAT b);

	RGBColor GetDiffuse() CONST;
	VOID SetDiffuse(CONST RGBColor& color);
	VOID SetDiffuse(FLOAT r, FLOAT g, FLOAT b);

	RGBColor GetSpecular() CONST;
	VOID SetSpecular(CONST RGBColor& color);
	VOID SetSpecular(FLOAT r, FLOAT g, FLOAT b);

	FLOAT GetConstantAttenuation() CONST;
	VOID SetConstantAttenuation(FLOAT x);

	FLOAT GetLinearAttenuation() CONST;
	VOID SetLinearAttenuation(FLOAT x);

	FLOAT GetQuadraticAttenuation() CONST;
	VOID SetQuadraticAttenuation(FLOAT x);

	FLOAT GetExponent() CONST;
	VOID SetExponent(FLOAT exponent);

private:
	// Attributes.
	//-----------------------------------------------
	Vector4   m_position;
	Vector4   m_direction;
	FLOAT	  m_angle;
	FLOAT     m_radius;

	RGBColor m_ambient;
	RGBColor m_diffuse;
	RGBColor m_specular;

	FLOAT    m_constant_attenuation;
	FLOAT    m_linear_attenuation;
	FLOAT    m_quadratic_attenuation;

	FLOAT    m_exponent;
};